home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsDOMCSSDeclaration.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  126 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is Mozilla Communicator client code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsDOMCSSDeclaration_h___
  38. #define nsDOMCSSDeclaration_h___
  39.  
  40. #include "nsICSSDeclaration.h"
  41. #include "nsIDOMCSS2Properties.h"
  42.  
  43. class nsCSSDeclaration;
  44. class nsICSSParser;
  45. class nsICSSLoader;
  46. class nsIURI;
  47.  
  48. class CSS2PropertiesTearoff : public nsIDOMNSCSS2Properties
  49. {
  50. public:
  51.   NS_DECL_ISUPPORTS_INHERITED
  52.  
  53.   NS_DECL_NSIDOMCSS2PROPERTIES
  54.   NS_DECL_NSIDOMNSCSS2PROPERTIES
  55.  
  56.   CSS2PropertiesTearoff(nsICSSDeclaration *aOuter);
  57.   virtual ~CSS2PropertiesTearoff();
  58.  
  59. private:
  60.   nsICSSDeclaration* mOuter;
  61. };
  62.  
  63. class nsDOMCSSDeclaration : public nsICSSDeclaration
  64. {
  65. public:
  66.   nsDOMCSSDeclaration();
  67.  
  68.   // Only implement QueryInterface; subclasses have the responsibility
  69.   // of implementing AddRef/Release.
  70.   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
  71.  
  72.   NS_DECL_NSICSSDECLARATION
  73.  
  74.   // Require subclasses to implement |GetParentRule|.
  75.   //NS_DECL_NSIDOMCSSSTYLEDECLARATION
  76.   NS_IMETHOD GetCssText(nsAString & aCssText);
  77.   NS_IMETHOD SetCssText(const nsAString & aCssText);
  78.   NS_IMETHOD GetPropertyValue(const nsAString & propertyName,
  79.                               nsAString & _retval);
  80.   NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName,
  81.                                  nsIDOMCSSValue **_retval);
  82.   NS_IMETHOD RemoveProperty(const nsAString & propertyName,
  83.                             nsAString & _retval);
  84.   NS_IMETHOD GetPropertyPriority(const nsAString & propertyName,
  85.                                  nsAString & _retval);
  86.   NS_IMETHOD SetProperty(const nsAString & propertyName,
  87.                          const nsAString & value, const nsAString & priority);
  88.   NS_IMETHOD GetLength(PRUint32 *aLength);
  89.   NS_IMETHOD Item(PRUint32 index, nsAString & _retval);
  90.   NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0; 
  91.  
  92.   virtual void DropReference() = 0;
  93. protected:
  94.   // Always fills in the out parameter, even on failure, and if the out
  95.   // parameter is null the nsresult will be the correct thing to
  96.   // propagate.
  97.   virtual nsresult GetCSSDeclaration(nsCSSDeclaration **aDecl,
  98.                                      PRBool aAllocate) = 0;
  99.   virtual nsresult DeclarationChanged() = 0;
  100.   
  101.   // This will only fail if it can't get a parser.  This means it can
  102.   // return NS_OK without aURI or aCSSLoader being initialized.
  103.   virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
  104.                                             nsIURI** aBaseURI,
  105.                                             nsICSSLoader** aCSSLoader,
  106.                                             nsICSSParser** aCSSParser) = 0;
  107.  
  108.   nsresult ParsePropertyValue(const nsCSSProperty aPropID,
  109.                               const nsAString& aPropValue);
  110.   nsresult ParseDeclaration(const nsAString& aDecl,
  111.                             PRBool aParseOnlyOneDecl, PRBool aClearOldDecl);
  112.  
  113.   // Prop-id based version of RemoveProperty.  Note that this does not
  114.   // return the old value; it just does a straight removal.
  115.   nsresult RemoveProperty(const nsCSSProperty aPropID);
  116.   
  117.   
  118. protected:
  119.   virtual ~nsDOMCSSDeclaration();
  120.  
  121. private:
  122.   CSS2PropertiesTearoff mInner;
  123. };
  124.  
  125. #endif // nsDOMCSSDeclaration_h___
  126.